package com.es.domain;

import lombok.Data;

/**
 * 描述:
 * es-meta-
 *
 * @author Derek
 * @create 2021-11-30 11:19
 */
@Data
public class EsMetaResult<T> {
    private Integer code;
    private String title;
    private T Data;

    public static EsMetaPageResult success(Object object){
        EsMetaPageResult  esMetaPageResult = new EsMetaPageResult();
        esMetaPageResult.setData(object);
        esMetaPageResult.setCode(ResultCodeEnum.SUCCESS.getCode());
        esMetaPageResult.setTitle(ResultCodeEnum.SUCCESS.getMsg());
        return esMetaPageResult;

    }
    public static EsMetaPageResult fail(){
        EsMetaPageResult  esMetaPageResult = new EsMetaPageResult();
        esMetaPageResult.setCode(ResultCodeEnum.FAIL.getCode());
        esMetaPageResult.setTitle(ResultCodeEnum.FAIL.getMsg());
        return esMetaPageResult;

    }
    public static EsMetaPageResult fail(String msg){
        EsMetaPageResult  esMetaPageResult = new EsMetaPageResult();
        esMetaPageResult.setCode(ResultCodeEnum.FAIL.getCode());
        esMetaPageResult.setTitle(msg);
        return esMetaPageResult;

    }
}
